import fetch
import url
import threading
import main

lock1 = threading.Lock()
lock2 = threading.Lock()
lock3 = threading.Lock()
lock2.acquire()
lock3.acquire()


def fetch_thread():
    while True:
        lock1.acquire()
        fetch.run()
        lock2.release()


def url_thread():
    while True:
        lock2.acquire()
        url.run()
        lock3.release()


def main_thread():
    while True:
        lock3.acquire()
        main.run()
        lock1.release()


if __name__ == '__main__':
    t1 = threading.Thread(target=fetch_thread)
    t2 = threading.Thread(target=url_thread)
    t3 = threading.Thread(target=main_thread)

    t1.start()
    t2.start()
    t3.start()
